-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat!: support byte range for raw block requests #57
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Gozala
approved these changes
May 13, 2024
src/util/range.js
Outdated
Comment on lines
30
to
34
export const resolveRange = (range, totalSize) => { | ||
const last = range[1] == null ? (totalSize - 1) : range[1] | ||
const first = range[1] == null && range[0] < 0 ? totalSize + range[0] : range[0] | ||
return [first, last] | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think following is a more clear way to to express it
Suggested change
export const resolveRange = (range, totalSize) => { | |
const last = range[1] == null ? (totalSize - 1) : range[1] | |
const first = range[1] == null && range[0] < 0 ? totalSize + range[0] : range[0] | |
return [first, last] | |
} | |
export const resolveRange = ([first, last], totalSize) => [ | |
first < 0 ? totalSize + first : first, | |
last ?? totalSize - 1 | |
] |
alanshaw
changed the title
feat: support byte range for raw block requests
feat!: support byte range for raw block requests
May 14, 2024
alanshaw
pushed a commit
that referenced
this pull request
May 14, 2024
🤖 I have created a release *beep* *boop* --- ## [5.0.0](v4.1.1...v5.0.0) (2024-05-14) ### ⚠ BREAKING CHANGES * dependencies for handlers have changed, splitting out block, DAG and unixfs services. These are all satisfied by the `Dagula` class for the time being. ### Features * support byte range for raw block requests ([#57](#57)) ([496cb24](496cb24)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Supports byte ranges for raw block requests - including multipart.
depends on storacha/dagula#44
refs storacha/freeway#100 (comment)